package o;

import android.app.AlertDialog;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.view.View;
import com.huawei.appgallery.foundation.ui.framework.widget.dialog.dialogactivity.DialogActivity.a;
import com.huawei.fastengine.fastview.download.utils.PackageUtils;
import com.huawei.hwid.core.constants.HwAccountConstants;
import o.cab.d;
import o.cab.e;
import o.cab.i;
import o.cab.j;

public class cac extends cae {
    public int ˏ() {
        return i.ʽॱ;
    }

    public void onClick(View view) {
        Context context = view.getContext();
        if (erz.ˏ(context, PackageUtils.HWGAMEBOX_PACKAGE_NAME)) {
            int ˎ = erz.ˎ(context, PackageUtils.HWGAMEBOX_PACKAGE_NAME);
            bqx.ˊ("GameCenterMenu", "hiGameVervionCode:" + ˎ);
            if (ˎ >= 90001000) {
                ˋ(context);
                return;
            } else {
                ˏ(context, j.ॱˋ, j.ॱᐝ);
                return;
            }
        }
        ˏ(context, j.ॱˎ, j.ॱˊ);
    }

    public int ˋ() {
        return e.ॱʽ;
    }

    public int ॱ() {
        return d.ॱॱ;
    }

    public int ˊ() {
        return e.ˍ;
    }

    private void ˋ(Context context) {
        if (context != null) {
            if (PackageUtils.HWGAMEBOX_PACKAGE_NAME.equals(context.getPackageName())) {
                cjm o_cjm = new cjm("market.activity", null);
                o_cjm.ॱ(context).setFlags(HwAccountConstants.FLAG_TRANSLUCENT_STATUS);
                cjk.ˎ().ˋ(context, o_cjm);
                return;
            }
            ced.ˎ(context, PackageUtils.HWGAMEBOX_PACKAGE_NAME, PackageUtils.HWGAMEBOX_PACKAGE_NAME);
        }
    }

    private void ˎ(Context context) {
        if (context != null) {
            try {
                Intent intent = new Intent();
                intent.setAction("com.huawei.appmarket.intent.action.AppDetail");
                intent.putExtra("APP_PACKAGENAME", PackageUtils.HWGAMEBOX_PACKAGE_NAME);
                intent.setPackage("com.huawei.appmarket");
                intent.setFlags(268435456);
                context.startActivity(intent);
            } catch (ActivityNotFoundException e) {
                bqx.ॱ("GameCenterMenu", "can not open higame detail");
            }
        }
    }

    private void ˏ(final Context context, int i, int i2) {
        if (context != null) {
            a aVar = new a(context, "GameCenterMenu");
            aVar.ॱ(i);
            aVar.ˋ(-1, i2);
            aVar.ˋ(-2, j.ͺ);
            aVar.ˏ(new ckh.a(this) {
                final /* synthetic */ cac ॱ;

                public void ˏ(AlertDialog alertDialog, a aVar, int i) {
                    if (-1 == i) {
                        this.ॱ.ˎ(context);
                    }
                }
            });
            aVar.ˎ();
        }
    }
}
